package com.quanyou.user.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.quanyou.base.framework.service.AbstractServiceImpl;
import com.quanyou.dao.UserDao;
import com.quanyou.dao.domain.User;
import com.quanyou.user.service.UserService;
import com.quanyou.user.vo.UserVo;

/**
 * 
 * @Title: UserServiceImpl.java
 * @Package com.quanyou.user.service.impl
 * @Description: 用户服务接口实现
 * @author yuanjie
 * @date 2017年7月7日 下午4:58:13
 * @version V1.0
 */
@Service
public class UserServiceImpl extends AbstractServiceImpl implements UserService {

	@Autowired
	private UserDao userDao;

	/**
	 * 根据用户账号获取用户信息
	 */
	@Override
	public UserVo getUserByAccount(String account) {
		User condition = new User();
		condition.setAccount(account);
		User user = userDao.get(condition);
		if (null == user) {
			return null;
		} else {
			UserVo userVo = new UserVo();
			userVo.setAccount(account);
			userVo.setUserCode(user.getUserCode());
			userVo.setUserName(user.getUserName());
			return userVo;
		}
	}

}
